/**
 * ...
 * >author		João Vítor de Souza
 */

package com.joaosouza.media 
{
	
	import com.joaosouza.core.platform.IPlatformFactory;
	import flash.events.EventDispatcher;

	public class SoundController extends EventDispatcher 
	{
		// ___________________________________________________________________ CONSTANTS
		
		// ___________________________________________________________________ CLASS PROPERTIES
		
		// ___________________________________________________________________ INSTANCE PROPERTIES
		
		private static var _instance	: SoundController;
		private var _sound				: IGameSound;
		
		// ___________________________________________________________________ GETTERS AND SETTERS
		
		public function get sound():IGameSound { return _sound; }
		
		// ___________________________________________________________________ CONSTRUCTOR
		
		public function SoundController (singleton:SingletonObligate) {}
		
		// ___________________________________________________________________ PUBLIC METHODS
		
		public static function getInstance () : SoundController
		{
			if (!SoundController._instance) SoundController._instance = new SoundController(new SingletonObligate());
			return SoundController(SoundController._instance);
		}
		
		public function init(factory:IPlatformFactory):void
		{
			if (_sound == null) _sound = factory.getGameSound();
		}		
		
		// ___________________________________________________________________ PRIVATE METHODS
		
		// ___________________________________________________________________ EVENTS
	}
}

class SingletonObligate {}
